#delimit;
clear;
capture log close;
set more off;

capture erase /data/degree_list.dta;
capture erase /data/major_list.dta;

!st /data/degree_list.sas7bdat /data/degree_list.dta;
!st /data/major_list.sas7bdat /data/major_list.dta;

local in "/data";
local out "/data";
local out1 "/data";

use "`out'/degree_list.dta", clear;
compress;
save, replace;

use "`out'/major_list.dta", clear;
compress;
save, replace;

/* Combining those who did and did not attend school*/
use "`in'/nsc_cleaned_forsas.dta", clear;
recast str100 Degree_Title; //need this to be able to merge based on Degree_Title, which is strL 
compress;
merge m:1 Degree_Title using "`out'/degree_list.dta";
drop _merge;
merge m:1 Major using "`out'/major_list.dta";
drop _merge;

replace DEG_GRP="OTHER" if DEG_GRP=="" & Graduated=="Y";
replace major_group=40 if major_group==. & Graduated=="Y";

rename TUEDT2003 pid;
save "`out1'/NSC_merged.dta", replace;


